public class Demo3 {
    static int result = 0;
    public static void main(String[] args) throws InterruptedException {

        Thread t1 = new Thread(()->{
            for (int i = 0; i < 50000; i++) {
                result++;
            }
        });
        Thread t2 = new Thread(()->{
            for (int i = 0; i < 50000; i++) {
                result++;
            }
        });
        t1.start();
        t1.join();
        t2.start();
        Thread.sleep(1000);
        System.out.println( result);
    }
}
